using System;
using JEng_Mark_1.Managers;
using Microsoft.Xna.Framework;

#if !XBOX360
using System.Windows.Forms;
using Microsoft.Xna.Framework.Graphics;
#endif

namespace JEng_TechDemo
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
#if !XBOX360
        [STAThread]
#endif
        static void Main(string[] args)
        {
            StartGame();
        }

        private static void StartGame()
        {
#if !XBOX360
            try
            {
#endif
                using (JEngineManager game = new JEngineManager())
                {
                    JEngineManager.Game = game;
                    SetupScene();
                    game.Run();
                }
#if !XBOX360
            }
            catch (NoSuitableGraphicsDeviceException)
            {
                MessageBox.Show("Pixel and vertex shaders 2.0 or greater are required", "JEng Tech Demo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (OutOfVideoMemoryException)
            {
                MessageBox.Show("Insufficent video memory.\n\n" +
                    "The graphics settings have been reconfigured to the minimum. " +
                    "Please restart the application. \n\nIf you continue to receive " +
                    "this error message, your system may not meet the " +
                    "minimum requirements.  \n\nCheck documentation for minimum requirements.", "JEng Tech Demo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "JEng Tech Demo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
#endif
        }

        private static void SetupScene()
        {
            MainMenuScreen mainMenu = new MainMenuScreen();
            JScreenManager.AddScreen(mainMenu);
        }
    }
}

